/* ****************************************************************************
 *
 * Copyright (c) Microsoft Corporation. 
 *
 * This source code is subject to terms and conditions of the Microsoft Public License. A 
 * copy of the license can be found in the License.html file at the root of this distribution. If 
 * you cannot locate the  Microsoft Public License, please send an email to 
 * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound 
 * by the terms of the Microsoft Public License.
 *
 * You must not remove this notice, or any other, from this software.
 *
 * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
 * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
 * PARTICULAR PURPOSE.
 * ***************************************************************************/



#if !defined(AFX_PGLVIEW_H__338966C8_1C93_11D4_8D89_00409503B978__INCLUDED_)
#define AFX_PGLVIEW_H__338966C8_1C93_11D4_8D89_00409503B978__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <pgl/core/PGLArchive.h>

/*!
	\defgroup PGLViewGroup Views : 2D view.
	\ingroup PGLCoreGroup
*/

/*! \brief A class that defines a screen region.

\ingroup PGLViewGroup
This class is used as a base to build 2D and 3D views. These
views will be used with OpenGL.
*/
class PGLCORE_EXT_CLASS CPGLViewScreen : public CObject
{
PGL_DECLARE_DYNCREATE(CPGLViewScreen);

public:

    CPGLViewScreen(int _iTx=0,int _iTy=0,int _iWidth=1,int _iHeight=1);
    CPGLViewScreen(const CPGLViewScreen& v){*this=v;};
    CPGLViewScreen& operator= (const CPGLViewScreen& v);

    ~CPGLViewScreen(){};
    /**@name Class Members*/
    //@{
    /// sets the viewport characteristics
    virtual void SetViewport(int _iTx,int _iTy,int _iWidth,int _iHeight)
    {   m_iTx=_iTx; m_iTy=_iTy; m_iWidth=__max(1,_iWidth); m_iHeight=__max(1,_iHeight);};

    /// pan the view of $x$ pixels horizontaly and $y$ pixels verticaly
    virtual void Pan(int x,int y){};
    /// zooms in
    virtual void ZoomIn(){};
    /// zooms out
    virtual void ZoomOut(){};
    /// zooming extent of view
    virtual void ZoomAll(double _left, double _right, double _bottom, double _top){};
    /// zoom the region of the screen describe by the 2 points $(xStart, yStart, xEnd, yEnd)$
    virtual void ZoomBox(int xStart,int yStart,int xEnd,int yEnd){};
    /// draws a white rectangle whose opposite corner are $(x_1,y_1)$ and $(x_2,y_2)$
    virtual void DrawBox(int x1,int y1, int x2, int y2){};
    virtual void DrawBackground(){};
    /// returns the height of the viewport
    int GetHeight() const
    { return m_iHeight;};
    /// returns the width of the viewport
    int GetWidth() const
    { return m_iWidth;};
    /// returns the lower left corner x-coordinate of the viewport
    int GetTx() const
    { return m_iTx;};
    /// returns the lower left corner y-coordinate of the viewport
    int GetTy() const
    { return m_iTy;};

    virtual void PlotGfx(gfxinterface::CGfxInterface& gfx);

    virtual double PixelToWorld(int iaxe, int pix)			{   return 0.0;};
    virtual double PixelToWorldCoord(int iaxe, int pix)		{   return 0.0;};
    virtual double PixelToWorld(int iaxe, double pix)		{   return 0.0;};
    virtual double PixelToWorldCoord(int iaxe, double pix)	{   return 0.0;};

	void SerializeXML(CPGLArchive& ar);
    /// Debuggin functions
#ifdef _DEBUG
    virtual void Dump( CDumpContext& dc ) const;
    virtual void AssertValid() const;    // Override
#endif

    //@}
protected:
    /**@name Class Parameters*/
    //@{
    /// lower left corner x-coordinate of the viewport
    int m_iTx;
    /// lower left corner y-coordinate of the viewport
    int m_iTy;
    /// width of the viewport (in pixels)
    int m_iWidth;
    /// height of the viewport (in pixels)
    int m_iHeight;
    //@}
};

#endif // !defined(AFX_VIEWCLASS_H__338966C8_1C93_11D4_8D89_00409503B978__INCLUDED_)
